Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.handleButtonEvent = function (e, t, r, n) {
  return h.apply(this, arguments)
}, exports.onRefresh = function () {
  return c.apply(this, arguments)
}, exports.tabDescList = void 0;
var e, t = require("../../../@babel/runtime/helpers/regeneratorRuntime"),
  r = require("../../../@babel/runtime/helpers/slicedToArray"),
  n = require("../../../@babel/runtime/helpers/asyncToGenerator"),
  a = require("../../../@babel/runtime/helpers/defineProperty"),
  s = require("../../../store/index"),
  u = require("../../../utils/helper/index"),
  i = require("../../../config/index"),
  o = (a(e = {}, i.typeMode.seeking, {
    title: "免费发布信息让机主主动联系您",
    btnText: "发布求租",
    url: "/subpackage/publish/seeking/index"
  }), a(e, i.typeMode.hire, {
    title: "免费发布机械让老板主动联系您",
    btnText: "发布出租",
    url: "/subpackage/publish/hire/index"
  }), a(e, i.typeMode.recruit, {
    title: "免费发布信息让驾驶员主动联系您",
    btnText: "发布驾驶员招聘",
    url: "/subpackage/publish/recruit/index"
  }), a(e, i.typeMode.sell, {
    title: "免费发布机械让买家主动联系您",
    btnText: "发布出售",
    url: "/subpackage/publish/sell/index"
  }), a(e, i.typeMode.askBuy, {
    title: "免费发布信息让机主主动联系您",
    btnText: "发布求购",
    url: "/subpackage/publish/ask-buy/index"
  }), e);

function c() {
  return (c = n(t().mark((function e() {
    var n, a, s, u, i, o, c, l, h, b = this,
      d = arguments;
    return t().wrap((function (e) {
      for (;;) switch (e.prev = e.next) {
        case 0:
          return n = d.length > 0 && void 0 !== d[0] ? d[0] : 1, this.page = n || 1, 1 !== n && this.setData({
            loading: !0
          }), e.prev = 2, a = {
            pageNum: this.page,
            pageSize: 15
          }, e.next = 6, console.log(this.data.mode), $.request[this.data.mode === 1 ? "GET/business/seek/rent/myList" : this.data.mode === 2 ? "GET/business/for/rent/myList" : "GET/business/recruit/worker/myList"](a);
        case 6:
          return s = e.sent, u = r(s, 1), i = u[0], console.log(i), i.data.data.map((item) => {
            item.title = item.description;
            item.time = item.createTime;
            item.timestamp = Date.parse(item.time) / 1000;
            item.uu_id = item.id;
            item.tag={
              title: "已通过",
              color: "#000",
              bgColor: "rgba(4, 181, 120, 1)"
            }
            if (item.status == 3) {
              item.check = 2;
            } else if (item.status == 1) {
              item.check = 2;
            } else {
              item.check = 2;
            }
            item.end = 1;
            item.fail_reason = item.auditRemark ? item.auditRemark : "审核拒绝";
          }), o = i.data.data, e.next = 12, p(this.data.mode, o);
        case 12:
          if (c = e.sent, 1 !== n || 0 !== c.length) {
            e.next = 15;
            break
          }
          return e.abrupt("return", void this.setData({
            noData: !0,
            list: []
          }));
        case 15:
          if (c.length < 15 ? this.setData({
              hasMore: !0
            }) : this.setData({
              hasMore: !1
            }), 1 !== n) {
            e.next = 17;
            break
          }
          return e.abrupt("return", void this.setData({
            list: c,
            noData: !1
          }));
        case 17:
          l = this.data.list.length, h = c.reduce((function (e, t, r) {
            return b.data.list.find((function (e) {
              return (null == e ? void 0 : e.uu_id) === t.uu_id
            })) ? e["list[".concat(r + l, "]")] = {} : e["list[".concat(r + l, "]")] = t, e
          }), {
            noData: !1
          }), this.setData(h);
        case 19:
          return e.prev = 19, this.setData({
            loading: !1
          }), e.finish(19);
        case 22:
        case "end":
          return e.stop()
      }
    }), e, this, [
      [2, , 19, 22]
    ])
  })))).apply(this, arguments)
}

function p(e, t) {
  return l.apply(this, arguments)
}

function l() {
  return (l = n(t().mark((function e(r, n) {
    var a;
    return t().wrap((function (e) {
      switch (e.prev = e.next) {
        case 0:
          return a = i.tagStatusList[r], e.abrupt("return", (n.forEach((function (e) {
            "2" == e.check && (e.tag = {
              title: a[Number(e.end)],
              bgColor: 1 == e.end ? "rgba(4, 181, 120, 1)" : "rgba(219, 219, 219, 1)"
            }, 2 == e.end ? e.btns = [{
              text: "重新发布",
              type: "1"
            }, {
              text: "修改",
              type: "2",
              color: "#0092ff"
            }] : 1 == e.end && (e.showShareBtn = !0, e.btns = [{
              text: "删除",
              type: "3"
            }, {
              text: "修改",
              type: "2"
            }], e.top && !e.top_over_due ? (e.btns.push(), e.showTopTime = !0) : e.top || e.top_over_due ? e.btns.push() : e.btns.push())), "1" == e.check && (e.tag = {
              title: "审核中",
              bgColor: "#0092ff"
            }, e.top && !e.top_over_due ? (e.btns = [], e.showTopTime = !0) : e.top || e.top_over_due ? e.btns = [] : e.btns = []), "0" == e.check && (e.tag = {
              title: "未通过",
              bgColor: "rgba(204, 58, 53, 1)"
            }, e.btns = [{
              text: "修改",
              type: "2"
            }, {
              text: "查看被拒原因",
              type: "6",
              color: "rgba(204, 58, 53, 1)"
            }])
          })), n));
        case 2:
        case "end":
          return e.stop()
      }
    }), e)
  })))).apply(this, arguments)
}

function h() {
  return (h = n(t().mark((function e(r, a, c, p) {
    var l, h, b, d, x, f, g;
    return t().wrap((function (e) {
      for (;;) switch (e.prev = e.next) {
        case 0:
          l = s.store.getState().global.machineConfig, h = l.refresh_machine_cost_coin, b = i.tagStatusList[c], d = a.type, e.t0 = d, e.next = "1" === e.t0 ? 4 : "2" === e.t0 ? 6 : "3" === e.t0 ? 9 : "4" === e.t0 ? 12 : "5" === e.t0 || "7" === e.t0 ? 15 : "6" === e.t0 ? 17 : "8" === e.t0 ? 19 : "9" === e.t0 ? 21 : 22;
          break;
        case 4:
          return $.jxAlert({
            mode: "confirm",
            hideClose: !0,
            title: "温馨提示",
            content: "您是否要重新发布本信息",
            confirmText: "重新发布",
            cancelText: "取消"
          }).then(n(t().mark((function e() {
            return t().wrap((function (e) {
              for (;;) switch (e.prev = e.next) {
                case 0:
                  return e.next = 2, u.publish.reqRepublish({
                    mode: c,
                    info: r.uu_id
                  });
                case 2:
                  return e.next = 4, null == p ? void 0 : p();
                case 4:
                case "end":
                  return e.stop()
              }
            }), e)
          })))), e.abrupt("break", 22);
        case 6:
          return (x = o[c].url) && $.router.push(x, {
            uu_id: r.uu_id
          }), e.abrupt("break", 22);
        case 9:
          return f = "取消发布后您的信息状态将变更为".concat(b[2], ", 用户无法查看电话联系您"), $.jxAlert({
            mode: "confirm",
            hideClose: !0,
            title: "温馨提示",
            content: f,
            confirmText: "确定",
            cancelText: "取消"
          }).then(n(t().mark((function e() {
            return t().wrap((function (e) {
              for (;;) switch (e.prev = e.next) {
                case 0:
                  return e.next = 2, u.publish.reqCancelRelease({
                    mode: c,
                    info: r.uu_id
                  });
                case 2:
                  return e.next = 4, null == p ? void 0 : p();
                case 4:
                case "end":
                  return e.stop()
              }
            }), e)
          })))), e.abrupt("break", 22);
        case 12:
          return g = [{
            text: "".concat(b[4], ", 能快速提升列表排名，消耗")
          }, {
            text: h,
            color: "#0092ff"
          }, {
            text: "个鱼泡币刷新"
          }], $.jxAlert({
            mode: "confirm",
            hideClose: !0,
            title: "刷新信息",
            content: g,
            confirmText: "去刷新",
            cancelText: "取消"
          }).then(n(t().mark((function e() {
            return t().wrap((function (e) {
              for (;;) switch (e.prev = e.next) {
                case 0:
                  return e.next = 2, u.publish.reqInfoRefresh({
                    mode: c,
                    info: r.uu_id
                  });
                case 2:
                  return e.next = 4, null == p ? void 0 : p();
                case 4:
                case "end":
                  return e.stop()
              }
            }), e)
          })))), e.abrupt("break", 22);
        case 15:
          return $.router.push("/subpackage/topset/rectopmset/index", {
            mode: c,
            uu_id: r.uu_id
          }), e.abrupt("break", 22);
        case 17:
          return $.jxAlert({
            mode: "warn",
            hideClose: !0,
            content: r.fail_reason,
            confirmText: "确定"
          }), e.abrupt("break", 22);
        case 19:
          return $.jxAlert({
            mode: "warn",
            content: "取消置顶，该信息将失去置顶效果，点击继续置顶可恢复置顶",
            confirmText: "确定"
          }).then(n(t().mark((function e() {
            return t().wrap((function (e) {
              for (;;) switch (e.prev = e.next) {
                case 0:
                  return e.next = 2, u.publish.reqCancelTop({
                    type: c,
                    info: r.uu_id
                  });
                case 2:
                  return e.next = 4, null == p ? void 0 : p();
                case 4:
                case "end":
                  return e.stop()
              }
            }), e)
          })))), e.abrupt("break", 22);
        case 21:
          u.publish.reqRestoreTop({
            mode: c,
            info: r.uu_id
          }).then((function () {
            null == p || p()
          }));
        case 22:
        case "end":
          return e.stop()
      }
    }), e)
  })))).apply(this, arguments)
}
exports.tabDescList = o;